package com.csc.bankingsystem.core.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;

/**
 * UserInfo Data Transfer Object
 * 
 * @author angelkid
 *
 */
@Entity
@Table(name = "USERINFOROLE")
public class UserInfoRole  extends BankingSystemAbstractEntity {
	private UserInfo userInfo;
	private UserRole userRole;
	
	@JsonManagedReference
	@ManyToOne
	@JoinColumn(name = "userInfoId")
	public UserInfo getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	
	@JsonManagedReference
	@ManyToOne
	@JoinColumn(name = "userRoleId")
	public UserRole getUserRole() {
		return userRole;
	}
	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}
	@Override
	public String toString() {
		return "UserInfoRole [userInfo=" + userInfo.getId() + ", userRole=" + userRole.getId()
				+ "]";
	}
	
	
}
